package com.jman.front.clients;

import com.jman.front.dto.*;

import java.util.List;

public class Agent {
    /**
     * 登录代理
     * @param client
     * @param loginFormDTO
     */
    public static Result login(LoginClient client, LoginFormDTO loginFormDTO){
        return client.login(loginFormDTO);
    }

    /**
     * 注册代理
     * @param client
     * @param registerFormDTO
     */
    public static Result register(RegisterClient client, RegisterFormDTO registerFormDTO){
        return client.register(registerFormDTO);
    }

    /**
     * 保存留言
     * @param client
     * @param messageDTO
     */
    public static String saveMessage(MessageClient client, MessageDTO messageDTO){
        return client.saveMessage(messageDTO);
    }

    /**
     * 获取留言
     * @param client
     */
    public static List<Message> getMessage(MessageClient client){
        return client.getMessageInfo();
    }

    /**
     * 删除留言
     * @param client
     * @param id
     */
    public static Boolean delMessage(MessageClient client, Integer id){
        return client.deleteById(id);
    }

    /**
     * 查看回复
     * @param client
     * @param id
     */
    public static List<ReplyToUser> getReply(ReplyClient client, Long id){
        return client.getReply(id);
    }

    /**
     * 保存回复
     * @param client
     * @param reply
     * @param id
     */
    public static Boolean saveReply(ReplyClient client, Reply reply, Long id){
        reply.setSenderId(id);
        return client.sendReply(reply);
    }

    /**
     * 查看公告内容
     * @param client
     * @param id
     */
    public static Announcement getAnnouncementById(AnnouncementClient client, Integer id){
        return client.getById(id);
    }

    /**
     * 获取公告展示信息
     * @param client
     */
    public static List<AnnouncementDTO> getPartsAnnouncement(AnnouncementClient client){
        return client.getParts();
    }

    /**
     * 保存公告信息
     * @param client
     * @param announcement
     */
    public static Boolean saveAnnouncement(AnnouncementClient client, Announcement announcement){
        return client.saveInfo(announcement);
    }

    /**
     * 获取所有公告信息
     * @param client
     */
    public static List<Announcement> getAllAnnouncement(AnnouncementClient client){
        return client.getAll();
    }

    /**
     * 删除公告信息
     * @param client
     * @param id
     */
    public static Boolean delAnnouncement(AnnouncementClient client, Integer id){
        return client.deleteById(id);
    }

    /**
     * 分页获取住户信息
     * @param client
     * @param pageInfo
     */
    public static PageBean<Resident> getPage(ResidentClient client, PageInfo pageInfo){
        return client.getInfoByPage(pageInfo);
    }

    /**
     * 修改住户信息
     * @param client
     * @param resident
     */
    public static Boolean updateResident(ResidentClient client, Resident resident){
        return client.updateResident(resident);
    }

    /**
     * 删除住户信息
     * @param client
     * @param id
     */
    public static Boolean delInfoById(ResidentClient client, Integer id){
        return client.deleteById(id);
    }

    /**
     * 测试方法
     */
    public static LoginFormDTO hello(LoginClient client){
        return client.hello();
    }
}
